#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QCloseEvent>

/// 中间文件名称
#define INTERMEDIATE_FILE_NAME  "result.ldx"
#define DECRYPT_FILE_NAME       "restore.bin"

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
protected:
    //这是一个虚函数，继承自QEvent.只要重写了这个虚函数，当你按下窗口右上角的"×"时，就会调用你所重写的此函数.
    void closeEvent(QCloseEvent*event);
private slots:
    void on_selctionProgram_button_clicked();

    void on_check_gzip_clicked(bool checked);

    void on_Check_MD5_clicked(bool checked);

    void on_check_AES_clicked(bool checked);

    void on_check_about_menu_clicked();

    void set_about_window_pointer();

    void on_set_MD5_triggered();

    void on_set_AES_triggered();

    void on_set_gzip_triggered();

    void on_startButton_clicked();

    void receive_aes_win_info(QString keys, int key_len, int mode, int padding);

    void on_fileName_lineText_editingFinished();

    void on_decrypt_Button_clicked();

private:
    Ui::MainWindow *ui;
    QByteArray MD5Encrypting(QByteArray array);
    QByteArray AESEncrypting(QByteArray array);
    QByteArray gzipEncrypting(QByteArray array);
    void writeIntermediateFiles(QByteArray array,QString fileName);
    void startEncrypting();
    QByteArray MD5Decrypt(QByteArray array);
    QByteArray AESDecrypt(QByteArray array);
    QByteArray gzipDecrypt(QByteArray array);
    // int ZlibGetDecodeLength(unsigned long  InRawLength);
    // int ZlibGetDecodeLength(QByteArray  InRawData);
    // long ZlibCompress(QByteArray  &OutEncodeData, QByteArray  InRawData,int  *nErrorCode);
    // long ZlibUncompress(QByteArray  &OutDecodeData, QByteArray InEncodeData, int   *nErrorCode);

};
#endif // MAINWINDOW_H
